package cn.springsoter.core.oss.config;

import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import cn.springsoter.core.oss.props.OssProperties;
import cn.springsoter.core.oss.rule.IOssRule;
import cn.springsoter.core.oss.rule.impl.OssRuleImpl;
import lombok.AllArgsConstructor;

/**
 * Oss配置类
 *
 * @author Kevin
 */
@Configuration
@AllArgsConstructor
@EnableConfigurationProperties(OssProperties.class)
@ConditionalOnProperty(name = "springsoter.oss.enable", havingValue = "true")
public class OssConfig {

	@Bean
	@ConditionalOnMissingBean(IOssRule.class)
	public IOssRule ossRule() {
		return new OssRuleImpl();
	}

}
